import React, {useEffect, useState} from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import {List, Picker} from '@ant-design/react-native';
import {useNavigation} from '@react-navigation/native';
import AreaView from '../../components/Layout/AreaView';
import SearchHeadIcon from '../../components/SearchHeadIcon';
import styles from './style';
import {Icon, TextareaItem, InputItem} from '@ant-design/react-native';
import {aftermarket} from '../../service/common';

const SaleAfter = (props) => {
  const navigation = useNavigation();
  const {
    route: {
      params: {orderId},
    },
  } = props;
  useEffect(() => {
    navigation.setOptions({
      title: '申请售后',
    });
  }, [navigation]);
  const [content, setContent] = useState('');
  return (
    <AreaView>
      <View style={styles.questiond_content}>
        <View style={styles.input_container}>
          <TextareaItem
            style={styles.textarea}
            rows={4}
            value={content}
            placeholder="请输入售后描述."
            onChangeText={(val) => setContent(val)}
          />
        </View>
        <View style={styles.btn_container}>
          <TouchableOpacity
            style={styles.btn}
            onPress={() => {
              aftermarket({
                aftermarketDesc: content,
                aftermarketType: 1,
                orderId,
              }).then((res) => {
                if (res.code * 1 === 200) {
                  navigation.goBack();
                }
              });
            }}>
            <Text style={styles.btn_text}>确定</Text>
          </TouchableOpacity>
        </View>
      </View>
    </AreaView>
  );
};

export default SaleAfter;
